//创建数据库连接
const mongoose = require("mongoose");
mongoose.connect("mongodb://127.0.0.1:27017/cq");
const db = mongoose.connection;

db.on("error", (err) => console.log(err));
db.on("open", () => {
  console.log("数据库连接成功");
});

module.exports = {
    mongoose,
    db
}